package com.tnstudio.Internet_Speedup_One_Click;

import java.util.*;

import org.json.JSONArray;
import org.json.JSONObject;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;





public class WebService {
	

	JSONArray contacts = null;
	ArrayList<HashMap<String, String>> contactList;
	
	
	public  boolean UploadFile(String FileName, byte[] buffer, long Offset) {
		
		
		// Create request
		SoapObject request = new SoapObject(SettingData.NAMESPACE, SettingData.SERVICE_UPLOAD);
		// Property which holds input parameters
		request.addProperty("FileName", FileName);
		request.addProperty("buffer", buffer);
		request.addProperty("Offset", Offset);
		
		
		//Create envelope
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
				SoapEnvelope.VER11);
		envelope.dotNet = true;
		// Set output SOAP object
		envelope.setOutputSoapObject(request);
		// Create HTTP call object
		HttpTransportSE androidHttpTransport = new HttpTransportSE(SettingData.URL);
		Integer i = 0;
		try {
			// Invole web service
			androidHttpTransport.call(SettingData.SOAP_ACTION+SettingData.SERVICE_UPLOAD, envelope);
			// Get the response
			SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
			// Assign it to fahren static variable
			
			boolean b = (Boolean.valueOf(response.toString())); 
			 return b;

		} catch (Exception e) {
			e.printStackTrace();
		
			return true;
		} 
		
		
	}

}